
#include <signal.h>
#include <string>
#include "deverifysig.h"
#if __linux
#include <pthread.h>
#include <unistd.h>
#include <sys/time.h>
#else
#include <Windows.h>
#include <process.h> 
#define sleep(n) Sleep((n*1000))
#endif

using namespace std;

#if __linux
static void * dodeverify(void *)
#else
static unsigned __stdcall dodeverify(void *)
#endif
{
    DeverifySig d;
    d.doit();
    return NULL;
}

int main(int argc, char** argv)
{
    tsthash();
    size_t num = atoi(argv[1]);
#if __linux
    for(int i = 0; i < num; i++){
        pthread_t tid;
        pthread_create(&tid, NULL, dodeverify, NULL);
        pthread_detach(tid);
    }

#else
    for (int i = 0; i < num; i++) {
        HANDLE mThreadHandler = (HANDLE)_beginthreadex(NULL, 0, dodeverify, NULL, 0, NULL);
        CloseHandle(mThreadHandler);
    }

#endif
    while (1) {
        sleep(1000);
    }
    return 0;
}
